package com.withoutwords;

import com.withoutwords.engine.social.FacebookController;
import com.withoutwords.ui.custom.MyCustomButton;
import com.withoutwords.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class FacebookTestActivity extends Activity implements OnClickListener {
	FacebookController fbController = new FacebookController();
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.facebooktest);
        
        MyCustomButton btn = (MyCustomButton)findViewById(R.id.btnLogin);
        btn.setOnClickListener(this);
        
        btn = (MyCustomButton)findViewById(R.id.btnShare);
        btn.setOnClickListener(this);
        
        btn = (MyCustomButton)findViewById(R.id.btnInvite);
        btn.setOnClickListener(this);
        
        btn = (MyCustomButton)findViewById(R.id.btnList);
        btn.setOnClickListener(this);
    }

	@Override
	public void onClick(View v) {
		switch (v.getId())
		{
			case R.id.btnLogin:
			{
				fbController.requestLogin(this,null);
				break;
			}
			case R.id.btnList:
			{
				fbController.readFriendList(true);
				break;
			}
			case R.id.btnShare:
			{
				fbController.share(this,"Hello, let's play");
				break;
			}
			case R.id.btnInvite:
			{
				fbController.inviteFriends(this, "come play with me :)");
				break;
			}
			default:break;
		}
		
	}
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		fbController.onLoginCallback(requestCode, resultCode, data);
	}
}
